﻿using System;
using System.Collections.Generic;
using System.Data;
using WorkFlow.DBProxy;

namespace WorkFlow.Engine.NSPermission
{
    public class WfRole
    {
        #region 变量

        public int ID { get; private set; }
        public string Name { get; private set; }
        public bool IsCreated { get; private set; }
        public DateTime LastModifiedTime { get; set; }
        #endregion

        #region constructor

        /// <summary>
        /// 
        /// </summary>
        /// <param name="org"></param>
        /// <param name="roleID"></param>
        public WfRole(int roleID)
        {
            DataTable dt =
                DB.MapToDataTable(string.Format(@"select F_ID,F_NAME,F_TYPE from t_roles o where f_id={0}", roleID));
            if (dt == null || dt.Rows.Count < 1)
            {
                IsCreated = false;
                return;
            }
            ID = Convert.ToInt32(dt.Rows[0]["F_ID"]);
            Name = dt.Rows[0]["F_NAME"].ToString();
            LastModifiedTime = DateTime.Now;
            IsCreated = true;
        }

        #endregion

    }
}